<?php

/*
	[ English learning assistant system]
	NAME:admin_model
*/
if (!defined('IN_ELS'))
{
    die('Hacking attempt');
}

class userbase extends base {
	function userbase() {
		$this->base();
	}
	//获取总数目
	function getdataCount($where){
		$sqlText = "select count(*) from members ";
		$sqlText .= $where;
		$data=$this->db->result_first($sqlText);
		return $data;
	}
	function getMemberCount(){
		$sqlText = "select count(*) from members where user_type=2 ";
		$data=$this->db->result_first($sqlText);
		return $data;
	}
	function getMembershangjiaCount(){
		$sqlText = "select count(*) from members where user_type=1 ";
		$data=$this->db->result_first($sqlText);
		return $data;
	}
	//获取详细
	function getdataList($where,$limitText){
		$sqlText  = "select *,FROM_UNIXTIME(create_time,'%Y-%m-%d %H:%i') create_time from members ";
		$sqlText .= $where;
		$sqlText .= " order by mid desc ";
		$sqlText .= $limitText;
		$data=$this->db->fetch_all($sqlText);
		return $data;
	}
	//获取单条详细信息
	function getinformation($mid){
		$sqlText = "select *,FROM_UNIXTIME(create_time,'%Y-%m-%d %H:%i') create_time from members where mid=$mid";
		$data=$this->db->fetch_first($sqlText);
		return $data;
	}
	function getinformation_phone($mobile_phone,$mid,$type){
		$sqlText = "select * from members where mobile_phone=$mobile_phone and mid<>$mid and type=$type";
		$data=$this->db->fetch_first($sqlText);
		return $data;
	}
	//修改信息
	function getuser_Update($data,$where){
		$retValue = $this->dbUpdate("members",$data,$where);
		return $retValue;
	}
	//添加信息
	function updateswitch($data,$where){
		$retValue = $this->dbUpdate("setting",$data,$where);
		return $retValue;
	}
	//获取信息
	function getswitchlist(){
		$sqlText  = "select * from setting where 1=1 ";
		$data=$this->db->fetch_first($sqlText);
		return $data;
	}
	
}

?>